//package com.plian.system.controller.hr.employment;
//
//import com.plian.Tools.Func;
//import com.plian.Tools.StringPool;
//import com.plian.Tools.base.BaseController;
//import com.plian.Tools.pagedata.PageData;
//import com.plian.system.config.Resubmit;
//import com.plian.system.dto.hr.employment.EmploymentPlanDTO;
//import com.plian.system.entity.hr.employment.EmployementPlan;
//import com.plian.system.model.CommonCode;
//import com.plian.system.model.ListResult;
//import com.plian.system.model.R;
//import com.plian.system.mybatis.support.Query;
//import com.plian.system.service.hr.employment.IEmploymentPlanService;
//import com.plian.system.service.wf.FormWorkflowService;
//import com.plian.system.vo.hr.employment.EmploymentPlanVO;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.AllArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.validation.Valid;
//import java.util.HashMap;
//import java.util.List;
//
//@Slf4j
//@RestController
//@AllArgsConstructor
//@RequestMapping("api/employmentPlan")
//@Api(value = "EmploymentPlanController", tags = "企业用工计划接口控制器")
//public class EmploymentPlanController extends BaseController {
//    private IEmploymentPlanService employmentPlanService;
//
//    private FormWorkflowService formWorkflowService;
//
//    @PostMapping("/submit")
//    @Resubmit(delaySeconds = 0)
//    @ApiOperation(value = "新增或调整", notes = "传入 employementPlan")
//    public R<EmployementPlan> submit(@Valid @RequestBody EmployementPlan employementPlan) {
//        boolean result = employmentPlanService.submit(employementPlan);
//
//       HashMap<String, Object> processVariable = new HashMap<>();
//       formWorkflowService.startProcessAndSimulate(String.valueOf(employementPlan.getId()),employementPlan.getFormType(),processVariable);
//
//        return result ? R.data(employementPlan) : new R(CommonCode.FAIL);
//    }
//
//    @PostMapping("/detail")
//    @ApiOperation(value = "详情", notes = "传入 employementPlan")
//    public R<EmploymentPlanVO> detail(@RequestBody EmployementPlan employementPlan) {
//        return R.data(employmentPlanService.getDetailObj(employementPlan));
//    }
//
//    @PostMapping("/list")
//    @ApiOperation(value = "分页", notes = "传入query")
//    public ListResult<EmploymentPlanVO> list(@RequestBody Query query) {
//        return employmentPlanService.list(query);
//    }
//
//    @PostMapping("/remove")
//    @ApiOperation(value = "删除", notes = "传入 ids")
//    public R remove(@RequestBody PageData pd) {
//        List<String> ids = (List<String>)pd.get("ids");
//        return employmentPlanService.deleteLogic(Func.toLongList(StringUtils.join(ids, StringPool.COMMA)))
//                ? new R(CommonCode.SUCCESS) : new R(CommonCode.FAIL);
//    }
//
//    @PostMapping(value = "/export")
//    @ApiOperation(value = "导出", notes = "传入 employmentDetailDTO")
//    public void exportExcel(@RequestBody EmploymentPlanDTO employmentPlanDTO, HttpServletRequest request, HttpServletResponse response){
//        employmentPlanService.exportExcel(employmentPlanDTO,request,response);
//    }
//}
